package cartes;

import game.Game;

import javax.swing.ImageIcon;


public class CartePasseTour extends CarteJoker {

	private TypeElement element;
	private String path;
	private ImageIcon image;


	public CartePasseTour(TypeElement element, String path) {
		super(TypeJoker.PASSETOUR);
		this.element = element;
		this.path = path;
		this.image = new ImageIcon(path);
	}

	public String getPath() {
		return path;
	}

	public ImageIcon getImage() {
		return image;
	}

	@Override
	public String print() {
		return super.print() + " de type " + element.toString();
	}

	@Override
	public boolean canPose() {
		if (Game.getInstance().getTalon() instanceof CarteElement) {
			CarteElement talonElem = (CarteElement) Game.getInstance().getTalon();
			if (talonElem.getElement() == this.element)
				return true;
		}

		if (Game.getInstance().getTalon() instanceof CartePlusUn) {
			CartePlusUn talonPlusUn = (CartePlusUn) Game.getInstance().getTalon();
			if (talonPlusUn.getElement() == this.element)
				return true;
		}
		if (Game.getInstance().getTalon() instanceof CartePlusQuatre) {
			CartePlusQuatre talonPlusQuatre = (CartePlusQuatre) Game.getInstance().getTalon();
			if (talonPlusQuatre.getElement() == this.element)
				return true;
		}

		if (Game.getInstance().getTalon() instanceof CartePasseTour) {
			return true;
		}
		return false;
	}

	public TypeElement getElement() {
		return element;
	}

	public String getValueS() {
		return " Interdit ";
	}

}
